##Adaptive Learning Task (ADLT)

In the cannon task, participants are instructed to place a shield at any point around a circle (Nassar et al., 2019). This shield covers only a portion of the 360-degree circle. The goal of the task is to infer where a cannonball might hit along the circle based on the information gathered from previous cannonball strikes and place the shield at those locations. Before each block of the task, the generative structure of the block is fully explained to the participants via written instructions and practice trials of the task. During the practice trials, participants can see where the cannon is aimed and use that information to place their shield. The cannon could theoretically hit anywhere within a 10-degree range from the center of the cannon’s muzzle. After this practice phase, participants complete the primary experiment where the cannon is removed and they must infer the cannon’s aim. The pattern of the cannon’s aim can either (1) change slightly within a specified range of the circle, with “oddball” cannonball shots striking about 14 percent of the time anywhere along the circle, or (2) remain stationary on most trials, and re-position to a random angle on approximately 14 percent of trials and remain stationary at this new angle. Participants receive explicit instructions regarding the nature of each of these blocks following the instructional phase, meaning they know whether the upcoming block will be from an oddball or change-point distribution. Participants complete 240 experimental trials in each condition, divided into 60-trial blocks, for a total of 480 trials. On each trial, participants adjust the position of their shield and lock in their decision. After their choice has been made, there is a 500ms delay before the location of the cannonball is revealed for 500ms. This provides an explicit representation of how far away the center of the shield fell from the cannonball’s strike, providing visual feedback about their PE from the cannonball’s actual location (Figure 2a, ii). After participants are shown how far off they were, the outcome of the task is revealed (Figure 2a, iii). After another brief delay (1000ms), the size of the participant’s shield is revealed alongside the cannonball, showing whether they successfully blocked the projectile. While the shield is always centered on the participant’s chosen location, it varies in size such that participants are never totally certain they will block the cannonball. Thus, minimizing the PE in the feedback phase is the optimal strategy for performing well in the task. At the end of a block, participants are provided feedback in terms of how many cannonballs they caught as a percentage of the total cannonballs.

##Pilot Data ###TL;DR for Data Cleaning This final dataframe resulting from this cleaning was used to re-vamp data structure from the task. Because the cleaning code will be updated, the current cleaning code does not need to be reviewed unless you suspect anaomalies in the resulting dataframe. For any questions related to the definition of task variables, please refer to: https://docs.google.com/spreadsheets/d/1V2UD28C_zAfH90BnNO3si6c0-qDUDFbHoU44rfdEt4I/edit#gid=1309555968. Skip to heading Pilot Results for information on pilot data.

It should also be noted that data for this pilot came from two, slightly different versions of the ADLT. The first version failed to record trial latency. Thus, latencies were only examined for a subset of participants.

Load Pilot Data…

Clean and Transform Pilot Data…

Clean and Transform Pilot Data…

Compare early and late data collection…

##Pilot Results Table 1. Task Performance. It appears people really struggled with learning the contingencies in this task.

subjects <- as.character(unique(distinct$subject)); plot_subjects <- list()
colormatrix <- ifelse(obj$avg_PE >= 60, wes_palette("Cavalcanti1")[c(1)], "white") ##potentially save these as bad_blocks vector
tab <- obj %>% flextable() %>% bg(j = 1:8, bg=colormatrix)

sink("/dev/null")
tab
sink(); 

Figure 1.Reaction time data. Below is a histogram of all reaction time data. Because response times were not limited and participants were not instructed to click quickly and accurately, it looks as though some RTs were incredibly long, upward of five minutes in some cases. When trimming off the more extreme responses ( I chose 10 seconds to be liberal), it does look like most people made their responses in an average of 900 ms. Changing the input to a mouse and adding instructions to click quickly and accurately should drastically reduce time spent in this task. Because this is a different input method than the eventual study, these data will not be further analyzed.

Hist_outliers <- ggplot(distinct_late, aes(x=trial.placeshield_mouse.latency)) + geom_histogram()
Mean_RT <- distinct_late %>% ungroup () %>% summarise(mean = mean(trial.placeshield_mouse.latency))
Hist_cleaned <- ggplot(distinct_late %>% filter(!trial.placeshield_mouse.latency > 10000), aes(x=trial.placeshield_mouse.latency)) + geom_histogram() ##liberal to relflect difficulties clicking with mouse
Mean_cleaned <- distinct_late %>% ungroup () %>% filter(!trial.placeshield_mouse.latency > 5000) %>% summarise(mean = mean(trial.placeshield_mouse.latency))

Hist_outliers; Mean_RT; Hist_cleaned; Mean_cleaned
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## # A tibble: 1 x 1
##    mean
##   <dbl>
## 1 1687.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## # A tibble: 1 x 1
##    mean
##   <dbl>
## 1  902.
plot_subjects <- list(); plot_subjects_angmu <- list()

for (i in subjects) {
  d <- distinct %>% dplyr::filter(subject == i && task_phase == "oddball")
  oddball <- ggplot(d, aes(x=trialnum, y=Abs_PE, color = catch_miss_factor)) + 
     geom_point() +
     geom_vline(aes(xintercept = changepoint, color = "Oddball")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(2,5,4)])) +
     xlab("Trial Number") + ylab("Response Type") + ggtitle(i) + ylim(0, 180) +
     facet_wrap(~block_code)

 change_point <- ggplot(distinct %>% dplyr::filter(subject == i && task_phase == "changepoint"), 
                        aes(x=trialnum, y=Abs_PE, color = catch_miss_factor)) + 
     geom_point() +
     geom_vline(aes(xintercept = changepoint, color = "Changepoint")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(4,2,5)]))  + 
     xlab("Trial Number") + ylab("Response Type") + ggtitle(i) + ylim(0, 180) +
     facet_wrap(~block_code)
  plot_subjects[[i]] <- list(oddball, change_point) 
 
}


for (i in subjects) {
  d <- distinct %>% dplyr::filter(subject == i && task_phase == "oddball")
  oddball <- ggplot(d, aes(x=trialnum, y=distmean, color = catch_miss_factor)) + 
     geom_point() +
     geom_vline(aes(xintercept = changepoint, color = "Oddball")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(2,5,4)])) +
     xlab("Trial Number") + ylab("Response Type") + ggtitle(paste(i), "Distance From Mean" ) + ylim(0, 180) + 
     facet_wrap(~block_code)

 change_point <- ggplot(distinct %>% dplyr::filter(subject == i && task_phase == "changepoint"), aes(x=trialnum, y=distmean, color = catch_miss_factor)) + 
     geom_point() +
     geom_vline(aes(xintercept = changepoint, color = "Changepoint")) + scale_color_manual(values = (wes_palette("Cavalcanti1")[c(4,2,5)]))  + 
     xlab("Trial Number") + ylab("Response Type") + ggtitle(paste(i), "Distance From Mean") + ylim(0, 180) +
     facet_wrap(~block_code)
  plot_subjects_angmu[[i]] <- list(oddball, change_point) 
 
}


#colormatrix <- ifelse(obj$above_threshold == "Below", wes_palette("Cavalcanti1")[c(4)], "white") ##potentially save these as bad_blocks vector
#tab <- obj %>% flextable() %>% bg(j = 1:8, bg=colormatrix)

#tab
plot_subjects; plot_subjects_angmu
## $`123`
## $`123`[[1]]
## Warning: Removed 209 rows containing missing values (geom_vline).

## 
## $`123`[[2]]
## Warning: Removed 206 rows containing missing values (geom_vline).

## 
## 
## $`162035100`
## $`162035100`[[1]]
## Warning: Removed 208 rows containing missing values (geom_vline).

## 
## $`162035100`[[2]]
## Warning: Removed 207 rows containing missing values (geom_vline).

## 
## 
## $`300`
## $`300`[[1]]
## Warning: Removed 206 rows containing missing values (geom_vline).

## 
## $`300`[[2]]
## Warning: Removed 207 rows containing missing values (geom_vline).

## 
## 
## $`530`
## $`530`[[1]]
## Warning: Removed 73 rows containing missing values (geom_vline).

## 
## $`530`[[2]]
## Warning: Removed 207 rows containing missing values (geom_vline).

## 
## 
## $`776`
## $`776`[[1]]
## Warning: Removed 205 rows containing missing values (geom_vline).

## 
## $`776`[[2]]
## Warning: Removed 210 rows containing missing values (geom_vline).

## 
## 
## $`3020817`
## $`3020817`[[1]]
## Warning: Removed 211 rows containing missing values (geom_vline).

## 
## $`3020817`[[2]]
## Warning: Removed 201 rows containing missing values (geom_vline).

## 
## 
## $`268301377`
## $`268301377`[[1]]
## Warning: Removed 204 rows containing missing values (geom_vline).

## 
## $`268301377`[[2]]
## Warning: Removed 208 rows containing missing values (geom_vline).

## 
## 
## $`313494383`
## $`313494383`[[1]]
## Warning: Removed 207 rows containing missing values (geom_vline).

## 
## $`313494383`[[2]]
## Warning: Removed 51 rows containing missing values (geom_vline).

## 
## 
## $`377055552`
## $`377055552`[[1]]
## Warning: Removed 204 rows containing missing values (geom_vline).

## 
## $`377055552`[[2]]
## Warning: Removed 210 rows containing missing values (geom_vline).

## $`123`
## $`123`[[1]]
## Warning: Removed 1 rows containing missing values (geom_point).

## Warning: Removed 209 rows containing missing values (geom_vline).

## 
## $`123`[[2]]
## Warning: Removed 113 rows containing missing values (geom_point).
## Warning: Removed 206 rows containing missing values (geom_vline).

## 
## 
## $`162035100`
## $`162035100`[[1]]
## Warning: Removed 131 rows containing missing values (geom_point).
## Warning: Removed 208 rows containing missing values (geom_vline).

## 
## $`162035100`[[2]]
## Warning: Removed 68 rows containing missing values (geom_point).
## Warning: Removed 207 rows containing missing values (geom_vline).

## 
## 
## $`300`
## $`300`[[1]]
## Warning: Removed 16 rows containing missing values (geom_point).
## Warning: Removed 206 rows containing missing values (geom_vline).

## 
## $`300`[[2]]
## Warning: Removed 29 rows containing missing values (geom_point).
## Warning: Removed 207 rows containing missing values (geom_vline).

## 
## 
## $`530`
## $`530`[[1]]
## Warning: Removed 59 rows containing missing values (geom_point).
## Warning: Removed 73 rows containing missing values (geom_vline).

## 
## $`530`[[2]]
## Warning: Removed 71 rows containing missing values (geom_point).
## Warning: Removed 207 rows containing missing values (geom_vline).

## 
## 
## $`776`
## $`776`[[1]]
## Warning: Removed 72 rows containing missing values (geom_point).
## Warning: Removed 205 rows containing missing values (geom_vline).

## 
## $`776`[[2]]
## Warning: Removed 82 rows containing missing values (geom_point).
## Warning: Removed 210 rows containing missing values (geom_vline).

## 
## 
## $`3020817`
## $`3020817`[[1]]
## Warning: Removed 7 rows containing missing values (geom_point).
## Warning: Removed 211 rows containing missing values (geom_vline).

## 
## $`3020817`[[2]]
## Warning: Removed 201 rows containing missing values (geom_vline).

## 
## 
## $`268301377`
## $`268301377`[[1]]
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 204 rows containing missing values (geom_vline).

## 
## $`268301377`[[2]]
## Warning: Removed 208 rows containing missing values (geom_vline).

## 
## 
## $`313494383`
## $`313494383`[[1]]
## Warning: Removed 7 rows containing missing values (geom_point).
## Warning: Removed 207 rows containing missing values (geom_vline).

## 
## $`313494383`[[2]]
## Warning: Removed 51 rows containing missing values (geom_vline).

## 
## 
## $`377055552`
## $`377055552`[[1]]
## Warning: Removed 11 rows containing missing values (geom_point).
## Warning: Removed 204 rows containing missing values (geom_vline).

## 
## $`377055552`[[2]]
## Warning: Removed 210 rows containing missing values (geom_vline).

###Pilot Findings Summary

##Task Reccomendations - For Michael Discussion 1. Already implemented: Clarify instructions Re: various suggestions from Piloters. a. Instructions have been simplified from “oddball” and “changepoint” blocks to “orange” and “blue” blocks - cannon lights up with various colors. b. Edits to wording to make instructions flow better. c. Removing unhelpful/confusing parts of instructions (instructing participants to miss on purpose) 2. Complaints about the task being difficult to figure out - kind of the point? a. Talk about percent cought/ideal success rate? 3. Not a consistent pattern across tasks (i.e., people always getting better?) a. individual PEs vs. distmean? b. not sure I calculated dist_mean in a way that makes sense 4. Collect 10-15 subjects and check for final timing.

##Data Check Plans - For Michael Discussion 8/26

  1. Translate dplyr operations into usable functions and try to duplicate as little as possible across tasks.
  2. drop_irregular function
  3. Check RTs and provide info on possible transforms